/*
 * Copyright 2007 The semap project development team.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Created by FAlex at 20.08.2007 12:40:20.
 *
 * ContactServ Application class.
 *
 * $Id$
 */

package com.google.code.contactserv.common.makers;

import com.google.code.contactserv.model.PropertyHolder;

import java.util.List;
import java.util.ArrayList;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Option;

public class PropertyPairsMaker {

    public static List<PropertyHolder> getPropertyPairs(CommandLine cmdLine) {
        Option[] options = cmdLine.getOptions();
        List<PropertyHolder> props = new ArrayList<PropertyHolder>();
        String name;

        for (Option option : options) {
            name = option.getLongOpt();
            if (name.equals("birthday")) name = "dateOfBirth";
//            if (name.equals("url")) {
//                PropertyHolder propertyHolder = new PropertyHolder("homepage", option.getValue());
//                propertyHolder.setOptional(true);
//                props.add(propertyHolder);
//                propertyHolder = new PropertyHolder("weblog", option.getValue());
//                propertyHolder.setOptional(true);
//                props.add(propertyHolder);
//                propertyHolder = new PropertyHolder("workpage", option.getValue());
//                propertyHolder.setOptional(true);
//                props.add(propertyHolder);
//                propertyHolder = new PropertyHolder("openid", option.getValue());
//                propertyHolder.setOptional(true);
//                props.add(propertyHolder);
//            } else {
                props.add(new PropertyHolder(name, option.getValue()));
//            }
        }
        return props;
    }
}
